/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * SettingsGroupPanel.java
 *
 * Created on Dec 27, 2009, 2:35:32 PM
 */

package dae.fxcreator.node.graph.uisetting;

import dae.fxcreator.io.templates.BooleanSetting;
import dae.fxcreator.io.templates.CodeSetting;
import dae.fxcreator.io.templates.ColorSetting;
import dae.fxcreator.io.templates.FloatSetting;
import dae.fxcreator.io.templates.GradientSetting;
import dae.fxcreator.io.templates.ImageFileSetting;
import dae.fxcreator.io.templates.IntSetting;
import dae.fxcreator.io.templates.OptionSetting;
import dae.fxcreator.io.templates.SemanticSetting;
import dae.fxcreator.io.templates.Setting;
import dae.fxcreator.io.templates.TextSetting;
import dae.fxcreator.node.SettingsGroup;
import java.util.List;

/**
 * Shows all the settings for a given settings group.
 * @author Koen
 */
public class SettingsGroupPanel extends javax.swing.JPanel {

    /** Creates new form SettingsGroupPanel */
    public SettingsGroupPanel() {
        initComponents();
    }

    public void setSettingsGroup(SettingsGroup group){
        List<Setting> settings = group.getSettings();
        for (Setting s: settings){
            if ( s instanceof TextSetting){
                TextSettingComponent tsc = new TextSettingComponent();
                tsc.setTextSetting((TextSetting)s);
                this.add(tsc);
            }else if ( s instanceof OptionSetting){
                OptionSettingComponent osc = new OptionSettingComponent();
                osc.setOptionSetting((OptionSetting)s);
                this.add(osc);
            }else if ( s instanceof FloatSetting) {
                FloatSettingComponent fsc = new FloatSettingComponent();
                fsc.setFloatSetting((FloatSetting)s);
                this.add(fsc);
            }else if ( s instanceof SemanticSetting) {
                SemanticSettingComponent ssc = new SemanticSettingComponent();
                ssc.setSemanticSetting((SemanticSetting)s);
                this.add(ssc);
            }else if ( s instanceof ColorSetting){
                ColorSettingComponent csc = new ColorSettingComponent();
                csc.setColorSetting((ColorSetting)s);
                this.add(csc);
            }else if ( s instanceof ImageFileSetting){
                ImageFileSettingComponent ifsc = new ImageFileSettingComponent();
                ifsc.setImageFileSetting((ImageFileSetting)s);
                this.add(ifsc);
            }else if ( s instanceof CodeSetting){
                CodeSettingComponent csc = new CodeSettingComponent();
                csc.setCodeSetting((CodeSetting)s);
                this.add(csc);
            }else if ( s instanceof IntSetting){
                IntSettingComponent isc = new IntSettingComponent();
                isc.setIntSetting((IntSetting)s);
                this.add(isc);
            }else if ( s instanceof BooleanSetting){
                BooleanSettingComponent bsc = new BooleanSettingComponent();
                bsc.setBooleanSetting((BooleanSetting)s);
                this.add(bsc);
            }else if ( s instanceof GradientSetting){
                GradientSettingComponent gsc = new GradientSettingComponent();
                gsc.setGradientSetting((GradientSetting)s);
                this.add(gsc);
            }
        }
        validate();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.Y_AXIS));
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables

}
